package com.zifeiyu.springbootaop.aop.controller;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author lxh96
 * @version 1.0
 * @description: user access control
 * @date 2021/8/15 11:21
 */
@RestController
public class UserController {
    
    /*** 
     * @description: 用户登录
     * @param:  
     * @return: java.lang.Object 
     * @author lxh96
     * @date: 2021/8/15 11:33
     */ 
    @RequestMapping("/login")
    public Object login(){
        return "login success";
    }

    /**
     * 参数的取值
     * @param name
     * @return
     */
    @RequestMapping("/login/{id}")
    public String login(@PathVariable("id") String id, @RequestParam("name") String name){
        return "welcome " + name+"\t您现在所在位置为"+id;
    }
    /*** 
     * @description: 模拟错误 
     * @param:  
     * @return: java.lang.Object 
     * @author lxh96
     * @date: 2021/8/15 11:50
     */ 
    @RequestMapping("/doError")
    public Object doError(){
        return 1/0;
    }
    /*** 
     * @description: 用户登出 
     * @param:  
     * @return: java.lang.Object 
     * @author lxh96
     * @date: 2021/8/15 11:50
     */ 
    @RequestMapping("/logOff")
    public Object logOff(){
        return "logOff success";
    }

}
